Return to doc.sitecore.com

Valid for Sitecore 5.2, 5.3
Which way of adding Sitecore controls to the Toolbox in Visual Studio .NET is the most common among developers (for example, placeholder, method rendering, and so on)?

Q:

Which way of adding Sitecore controls to the Toolbox in Visual Studio .NET is the most common among developers (placeholder, method rendering, and so on)?

A: 

To enable dragging Sitecore controls onto .aspx and .ascx files in Visual Studio .NET:  

1.       Open a Sitecore project.
 

2.       Right-click on the Toolbox and add a tab named Sitecore.
 

3.       Right-click on the new tab and select Add/Remove Items.
 

4.       Press Browse and select Sitecore.Kernel.dll from the project’s /bin directory.  The Visual Studio selects all controls in the assembly by default. 
 

5.       Click on the Assembly column heading to sort by that column, scroll to the Sitecore section and unselect the first selected Sitecore control.  The Visual Studio will unselect all of the other Sitecore controls. 
 

6.       Click on the first row to disable the entire selection.
 

7.       Sort by the Namespace column, and then select the checkboxes next to controls to include (generally ContentDot, Method, Placeholder, Sublayout, WebPage and XslFile in Sitecore.Web.UI.WebControls).

Use the design.config file from the document root if required.  When creating controls using the Toolbox, the required attributes defined in the Sitecore’s sublayout and rendering configurations are not copied; complete properties of all controls as needed.  The following properties are relevant:  

All Renderings

Caching

See http://sdn.sitecore.net/Articles/Media/Caching%20Renderings.html.

 

RenderingID

If specified, caching and possibly other options will be retrieved from the referenced rendering at runtime instead of the attributes assigned in the layout.

 

ID

The .NET page-unique control identifier.

XSL Renderings

Path

The path to the .xsl file.

Method Renderings

ClassName

A fully qualified class name containing a method to execute.

 

MethodName

The name of the ClassName method to execute.

 

AssemblyName

The assembly name containing ClassName (without the .dll extension).

Placeholders

Key

The name by which sublayouts and renderings can be bound to this Placeholder.

Sublayout

Path

The path to the .ascx file.

Some Sitecore versions may generate JavaScript errors in the Layout Studio if required parameters are not present.